Add data-raw/regenerate_bib.R helper for vignettes/references.bib#70
Merged
Conversation
After v0.2.6 the bib was regenerated by hand whenever pandoc cite markers changed in either regional vignette. This formalizes the recipe — option 1 of the three discussed (conservative; doesn't break CI): - New `data-raw/regenerate_bib.R` reads both regional vignettes, detects the union of citation keys via rbbt::bbt_detect_citations, pulls bib entries via rbbt::bbt_bib + bbt_return action, writes to vignettes/references.bib. Logs key counts per vignette + any vignette-only keys for visibility. Verified idempotent on the current main (writes the same 18 entries already there). - HTML comment block at the top of each regional vignette pointing to the helper. (Initial drafts had `[@key]` literals in the comments which rbbt detected as a phantom citation; reworded to "pandoc citation markers" to avoid the false positive.) - CLAUDE.md Vignettes section gets a one-paragraph note pointing to the helper + listing the BBT prerequisite + clarifying CI doesn't run it. Trade-off vs embedding the rbbt call in the YAML directly: that would always-fresh the bib at render time but breaks pkgdown CI (no Zotero on the runner). Pre-commit hook (option 3) was deferred as more involved. Refs #69.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data-raw/regenerate_bib.R— readsvignettes/kootenay-lake.Rmd+vignettes/peace-fwcp.Rmd, detects the union of citation keys viarbbt::bbt_detect_citations, pulls bib entries viarbbt::bbt_bib(..., .action = rbbt::bbt_return), writesvignettes/references.bib. Logs per-vignette key counts and flags any vignette-only keys for visibility. Verified idempotent on current main — writes the same 18 entries already there.[@key]in the comment which rbbt picked up as a phantom citation (broke the helper on first run); reworded to "pandoc citation markers" to avoid the false positive — small but instructive bug.Trade-off vs option 2 (embed
rbbt::bbt_update_bib()in YAML at render time) and option 3 (pre-commit hook): option 2 always-freshes the bib but breaks pkgdown CI (no Zotero on the runner); option 3 is more involved. Option 1 here is the cheap-and-correct middle ground.Relates to NewGraphEnvironment/sred-2025-2026#23.
Fixes #69.
Test plan
lintr::lint('data-raw/regenerate_bib.R')→ 0 lints (verified)rbbtwas already a project dev tool🤖 Generated with Claude Code